export default class SoundsBtn{
    onEnable(){
        var name = this.owner.name;
        this.isMusic = name.indexOf('music')>=0;
        this.name = "menu/"+name+"_";
        this.refresh();
        console.log('name'+name);
    }
    onClick(){
        this.changeState();
    }

    changeState(e) {
        var status = !(this.isMusic ? SoundsManager.instance.isMusicEnabled : SoundsManager.instance.isSoundEnabled);
        this.isMusic ? SoundsManager.instance.setMusic(status) : SoundsManager.instance.setSound(status);
        this.refresh();
    };
    refresh() {
        var enabled = this.isMusic ? SoundsManager.instance.isMusicEnabled : SoundsManager.instance.isSoundEnabled;
        var name = this.name+(enabled?1:0)+'.png';
        console.log(name);
        //this.loadImage(name);
    };
}